package com.texaco.chapasFutbol.multiplayer.mensajes;

import java.util.Map;

import org.json.JSONException;

public class MatchMessage extends BaseMessage{
	
	private static final long serialVersionUID = -3612789310470014899L;
	private long idMatch;
	private long idClient;
	private String team;
	
	public MatchMessage() throws JSONException{
		super(MESSAGE_MACH);
	}
	
	public MatchMessage(String jsonStr) throws JSONException{
		super(MESSAGE_MACH, jsonStr);
	}
	
	public MatchMessage(Map<String, String> jsonMap) throws JSONException{
		super(MESSAGE_MACH, jsonMap);
	}
	
	@Override
	protected void preRead() {
		try {
			idMatch = getLong(FIELD_ID_MATCH);
			idClient = getLong(FIELD_ID_CLIENT);
			team = getStr(FIELD_TEAM);
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}

	@Override
	protected void preWrite() {
		try {
			put(FIELD_ID_MATCH, idMatch);
			put(FIELD_ID_CLIENT, idClient);
			put(FIELD_TEAM, team);
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}

	public long getIdMatch() {
		return idMatch;
	}

	public void setIdMatch(long idMatch) {
		this.idMatch = idMatch;
	}

	public long getIdClient() {
		return idClient;
	}

	public void setIdClient(long idClient) {
		this.idClient = idClient;
	}

	public String getTeam() {
		return team;
	}

	public void setTeam(String team) {
		this.team = team;
	}
}
